import __javable.core.util.ProcessPool;

/**       
 * @{#} Main.java Create on 2012-3-26 下午10:25:46       
 *       
 * Copyright (c) 2012 by able.       
 */

/**
 * 
 * 
 * @history <PRE>
 * --------------------------------------------------------- 
 * VERSION       DATE            BY       CHANGE/COMMENT 
 * --------------------------------------------------------- 
 * 1.0           2012-3-26      able         create 
 * ---------------------------------------------------------
 * </PRE>
 * 
 */
public class Main {

	public static void main(String[] args) throws Exception {

		new ProcessPool<String>(3) {
			@Override
			public void Process(String obj) {
				System.out.println((String) obj);
				try {
					Thread.sleep((int) (Math.random() * 10000));
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		for (int i = 0; i < 10; i++) {
			ProcessPool.push("===" + i + "===");
		}
		System.in.read();

		// new ProcessPool<Socket>(3) {
		// @Override
		// public void Process(Socket socket) {
		// }
		// };
		// ServerSocket server = new ServerSocket(3000, 5);
		// Socket incomingConnection = null;
		// while (true) {
		// incomingConnection = server.accept();
		// server.accept();
		// ProcessPool.push(incomingConnection);
		// }
	}
}
